﻿using System;
using Microsoft.SqlServer.Server;

namespace MsSqlSpatial.UserDefinedTypes
{
    internal static class SqlUtility
    {
        public static void WriteExceptionToPipe(Exception ex)
        {
            WriteToPipe(string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
        }

        public static void WriteToPipe(string message)
        {
            if (SqlContext.IsAvailable)
                SqlContext.Pipe.Send(message);
        }
    }
}